﻿// See https://aka.ms/new-console-template for more information



using System.IMServer.Client;

var host = "https://authcenter.gcc.gcc:7443";
var guid = Guid.NewGuid().ToString("N");
Manager.InitIMServers(host);
var allUser = Manager.GetAllUser(guid, new GCCGrpc.IMServer.GetAllUserRequest());

Manager.SendMessageToUser(guid, new GCCGrpc.IMServer.SendMessageToUserRequest()
{
    UID = allUser.Users[0].UID,
    Text = System.Text.Json.JsonSerializer.Serialize(new UserSendMessage()
    {
        From = "System",
        FromClient = "测试客户端Console",
        FromClientType = "console 程序",
        To = allUser.Users[0].UID,
        Data = "啊啊啊啊",
        ToClientID = allUser.Users[0].ClientID,
        ToClientType = allUser.Users[0].ClientType,
    }, LuanNiao.JsonConverterExtends.CommonSerializerOptions.CamelCaseChineseNameCaseInsensitive)
});


Manager.SendMessageToAllUser(guid, new GCCGrpc.IMServer.SendMessageToAllUserRequest()
{
    Text = System.Text.Json.JsonSerializer.Serialize(new UserSendMessage()
    {
        From = "System",
        FromClient = "测试客户端Console",
        FromClientType = "console 程序",
        To = allUser.Users[0].UID,
        Data = "广播,谁都能收",
        ToClientID = allUser.Users[0].ClientID,
        ToClientType = allUser.Users[0].ClientType,
    }, LuanNiao.JsonConverterExtends.CommonSerializerOptions.CamelCaseChineseNameCaseInsensitive)
});

//Manager.SendMessageToUserClient(guid, new GCCGrpc.IMServer.SendMessageToUserClientRequest()
//{

//    UID = allUser.Users[0].UID,
//    Text = System.Text.Json.JsonSerializer.Serialize(new UserSendMessage()
//    {
//        From = "测试客户端",
//        FromClient = "测试客户端Console",
//        FromClientType = "console 程序",
//        To = allUser.Users[0].UID,
//        Data = "随机",
//        ToClientID = allUser.Users[1].ClientID,
//        ToClientType = allUser.Users[1].ClientType,
//    }, LuanNiao.JsonConverterExtends.CommonSerializerOptions.CamelCaseChineseNameCaseInsensitive),
//    ClientID = allUser.Users[1].ClientID,
//});

//Manager.ForcedOffline(guid, new GCCGrpc.IMServer.ForcedOfflineRequest()
//{

//    UID = allUser.Users[0].UID,
//    ClientID = allUser.Users[1].ClientID,
//});



Console.WriteLine("Hello, World!");
